package com.egg.ylt.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.egg.ylt.R;
import com.egg.ylt.pojo.GrowthPhotoClassicListEntity;
import com.egg.ylt.presenter.impl.GrowthStampPresenter;
import com.yonyou.framework.library.adapter.rv.CommonAdapter;
import com.yonyou.framework.library.adapter.rv.ViewHolder;

/**
 * Created By Dlx
 * on 2019/3/1
 */
public class ADA_GrowthPhotosClassic extends CommonAdapter<GrowthPhotoClassicListEntity.ListBean> {
    private GrowthStampPresenter mPresenter;

    public ADA_GrowthPhotosClassic(Context context, GrowthStampPresenter presenter) {
        super(context);
        mPresenter = presenter;
    }

    @Override
    protected int itemLayoutId() {
        return R.layout.item_growth_diary_classic;
    }

    @Override
    protected void convert(ViewHolder holder, final GrowthPhotoClassicListEntity.ListBean listBean, int position) {
        holder.setText(R.id.diary_maincontent_tv, listBean.getName());
        holder.setText(R.id.diary_tips_tv, "共有" + listBean.getNum() + "张照片");
        Glide.with(mContext).load(listBean.getImage()).placeholder(R.drawable.icon_picloading).into((ImageView) holder.getView(R.id.diary_header_iv));
        holder.setOnClickListener(R.id.diary_clickbound_constraintlayout, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mPresenter.jumpToBabyPhotosListActivity(listBean.getName(), listBean.getType());
            }
        });
    }
}
